Syntax operations also need to ensure project is present for the open script infos since update could be pending to make sure open script info has project - #50418
Conversation
… script infos since update could be pending to make sure open script info has project Also convert one relevant test case to baseline Fixes #50131
Andrew Casey (amcasey)
left a comment
There was a problem hiding this comment.
Why would a project be required for outlining spans? Are there project-scoped settings that affect the behavior? Same question for (e.g.) brace matching.
|
So what exactly happened before? Was it something like this?
|
|
|
I'm still missing why we'd need a project at all to handle this request. Is that just an unfortunate consequence of our design? |
| const testsConfig: File = { | ||
| path: `${tscWatch.projectRoot}/playground/tsconfig.json`, | ||
| content: "{}" | ||
| }; | ||
| const testsFile: File = { | ||
| path: `${tscWatch.projectRoot}/playground/tests.ts`, | ||
| content: `export function foo() {}` | ||
| }; |
There was a problem hiding this comment.
This is a bit of a nit - but really, is the idea that that playground contains some sort of implementation file, and playground/tests would contain the test file? In theory, you should only need 2 tsconfigs and 2 .ts files - but you don't need innerSrcFile, right?
src/
├── tsconfig.json
├── foo.ts
└── spec/
├── tsconfig.json
└── foo.ts
There was a problem hiding this comment.
This is replication of repro at #50131 (comment)
The playground/tsconfig.json is tests config i think or atleast the file opened was test file which imported the inner test file
The innerConfig is the implementation configuration but the test file resides next to it and isnt part of the config
Definitely not ideal configuration for sure. But the PR ensures that we dont crash and project is assigned.
We never look past first tsconfig.json we find because otherwise we would risk loading too many projects when opening file.
Thats our design for now.. in most cases the open files are already part of the project (the scenario we are fixing is just unfortunate) so it was never priority to experiment separate project for syntax only operations. (To get hold of LS on which we can forward those requests) |
Also convert one relevant test case to baseline
Fixes #50131